<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript">
        function changeImg(){
            //拿到图片对象
            var img = document.getElementById('icon');
            console.log(img);
            //更改图片
            img.src = 'images/img_02.jpg';
        }
    </script>
</head>
<body>
<img id="icon" src="images/img_01.jpg">
<p></p>
<button onclick="changeImg();">更改图片</button>
</body>
</html>